/**
 * Definition for singly-linked list.
 * function ListNode(val) {
 *     this.val = val;
 *     this.next = null;
 * }
 */
/**
 * @param {ListNode} head
 * @return {number[]}
 */
 var reversePrint = function(head) {
     let arr=[];
     let newarr=[];
    while(head!=null){
        arr.push(head.val);
        head=head.next;
    }
    let i=arr.length-1;
    while(i>=0){
        newarr.push(arr[i]);
        i--;
    }
    return newarr;
};